package org.rednebula.framework.core.context;

import java.io.Serializable;

import org.rednebula.framework.core.BasicContext;
import org.rednebula.framework.core.ProcedureEngine;


public class ProcedureContext extends BasicContext implements Serializable {
	ProcedureEngine engine;
	public ProcedureContext(ProcedureEngine engine) {
		super();
		this.setName(PROCEDUREENGINE);
		this.engine=engine;
	}

	public ProcedureEngine getEngine(){
		return this.engine;
	}
	public void close() {
		this.engine=null;

	}

	public <T> T get(String key) {
		if(isSelf(key))return (T)this.getEngine();
		return getEngine().get(key);
	}

	public <T> T get(Class<T> type) {
		return this.getEngine().get(type);
	}

	public boolean has(String name) {
		return this.isSelf(name)|| getEngine().has(name);
	}

}
